//
//  BstTableContentViewCell.m
//  Demo
//
//  Created by colawh on 2019/3/18.
//  Copyright © 2019年 colawhdfws. All rights reserved.
//

#import "BstTableContentViewCell.h"
#import "BsTableView.h"

@interface BstTableContentViewCell ()

@property (nonatomic,strong) BsTableView *contentTabView;

@end

@implementation BstTableContentViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configUI];
    }
    return self;
}
- (void)configureUIWithArray:(NSMutableArray *)array
{
    self.contentTabView.dataSource = [array mutableCopy];
    [self addSubview:self.contentTabView];
    _contentTabView.backgroundColor = [UIColor clearColor];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (self.refreshBlock) {
            self.refreshBlock();
        }
    });
}
- (void)configUI{
    [self addSubview:self.contentTabView];
    _contentTabView.backgroundColor = [UIColor clearColor];
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        if (self.refreshBlock) {
//            self.refreshBlock();
//        }
//    });
    
}
- (CGFloat)realHeight{
    return 50+[_contentTabView realHeight];
}

- (void)layoutSubviews{
    [super layoutSubviews];

    [_contentTabView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@50);
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.bottom.equalTo(@0);
    }];
}
- (BsTableView *)contentTabView{
    if (!_contentTabView) {
        _contentTabView = [[BsTableView alloc]init];
    }
    return _contentTabView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
